package com.chenhs.oop.study;

/**
 * @program: JAVA300
 * @description: 重写toString方法
 * @author: peanut
 * @create: 2018-12-16 23:04
 */
public class OverrideToString {

    String name;
    int age;

    public OverrideToString(String name, int age) {
        this.name = name;
        this.age = age;

    }

    @Override
    /**
     *@Description: &#x91cd;&#x5199;toString &#x65b9;&#x6cd5;
     *@Param: * @param
     *@return: java.lang.String
     *@Author: peanut
     *@date 2018/12/16 23:49
     */
    public String toString() {

        return "我是" + name + "，今年" + age + "岁了。" ;
    }
    public static void main(String[] args) {
        OverrideToString a = new OverrideToString("张三",15);
        System.out.println(a.toString());
    }
}
